<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../js/axios-0.18.0.js"></script>
<script src="../js/vue.js"></script>
<script src="../js/util.js"></script>
<body>
<div id="app">
    <h1>修改页面</h1>
    <table border="1">
        <tr>
            <td>ID</td>
            <td><input type="text" v-model="pojo.id" readonly></td>
        </tr>
        <tr>
            <td>编号</td>
            <td><input type="number" v-model="pojo.bh" ></td>
        </tr>
        <tr>
            <td>姓名</td>
            <td><input type="text" v-model="pojo.name" ></td>
        </tr>
        <tr>
            <td>身份证</td>
            <td><input type="number" v-model="pojo.sfzh" ></td>
        </tr>
        <tr>
            <td>性别</td>
            <td><input type="radio" v-model="pojo.sex"  value="男">男
                <input type="radio" v-model="pojo.sex"  value="女">女
            </td>
        </tr>
        <tr>
            <td>手机号</td>
            <td><input type="number" v-model="pojo.sjh" ></td>
        </tr>
        <tr>
            <td>邮箱</td>
            <td><input type="number" v-model="pojo.yx" >@qq.com</td>
        </tr>
        <tr align="center">
            <td colspan="2"> <button type="button" @click="add()">添加</button></td>

        </tr>

    </table>
</div>
<script>
    new Vue({
        el:"#app",
        data:{
            pojo:{}
        },
        methods:{
            add(){
                axios.post("http://localhost:10010/user/update",this.pojo).then(
                    res=>{
                       alert("保存成功");
                       location.href="main.html"
                    }
                )
            },
            hx(){

                var id=getQueryString("id")

                axios.get("http://localhost:10010/user/hx?id="+id).then(
                    res=>{
                      this.pojo=res.data
                    }
                )
            }
        },
        created(){
            this.hx()
        }
    })
</script>
</body>
</html>